package com.richfit.barcodesystem_cczt.fragments.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

import lombok.Data;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@Data
public class ZBoxEntity implements Serializable {
//    {
//        "id":"123321123",装箱单id
//            "zboxNum":"zbox-zyl-02",装箱单号
//            "supplierId":"1000000001",供应商id
//            "supplierCode":"1000000001",供应商编码
//            "supplierDesc":"IMW物资有限公司",供应商描述
//            "contractNum":"玉兰-测试-合同2",合同号
//            "projectArea":""项目部区域
//    }

    private String id;
    private String zboxNum;
    private String supplierId;
    private String supplierCode;
    private String supplierDesc;
    /**
     * 合同号
     */
    private String contractNum;
    /*
     *项目部区域
     */
    private String projectArea;
    /**
     * 库存地点
     */
    private String inv;
    /**
     * 仓位
     */
    private String location;
    /**
     * 过账日期
     */
    private String transfer_Date;
    private List<Line> lines;

    /**
     * 包装箱信息
     */
    @NoArgsConstructor
    @Data
    public static class Line implements Serializable {
//        {
//            "zboxId":"706D2DABF6F20BD72EC1B2DC6954109",
//                "zboxBarcode":"202100002120210000210001",
//                "transId":"C66866DD07620C09D2F98B67E2EBAB91",
//                "fboxId":"2A3BAA43B9B421D70F3BD43E95EFE95F",
//                "remark":"null",
//                "zboxLineId":"26C28472946D09B4825D377B7F41E9DC",
//                "manufacturer":"null",
//                "id":"30530DBDABE6C1B2874388653C35DF3",
//                "height":2,
//                "storeMan":"5d2a4aacd1d8448ab3b72e869d1d6cc6",
//                "createOrg":"C104004004",
//                "transNum":"D-C1040040042021010",
//                "length":2,
//                "packingSpec":"包装方式",
//                "fboxNum":"F-C1040040042021020",
//                "transLineId":"EFE3D8C56C86E585D6C6C7C308C26A79",
//                "volume":8,
//                "grossWeight":12,
//                "zboxNum":"2021000021",
//                "netWeight":10,
//                "boxNo":"0001",
//                "boxNum":"2021000021",
//                "transfFlag":"FBOX-0000003000000005",
//                "width":2,
//                "lineNum":1,
//                "location":"HM-01"
//        }

        private Boolean isChecked = false;
        /**
         * 仓位
         */
        private String location;
        /**
         * zboxId
         */
        private String zboxId;
        /**
         * zboxBarcode
         */
        private String zboxBarcode;
        /**
         * transId
         */
        private String transId;
        /**
         * fboxId
         */
        private String fboxId;
        /**
         * remark
         */
        private String remark;
        /**
         * zboxLineId
         */
        private String zboxLineId;
        /**
         * manufacturer
         */
        private String manufacturer;
        /**
         * id
         */
        private String id;
        /**
         * height
         */
        private String height;
        /**
         * storeMan
         */
        private String storeMan;
        /**
         * createOrg
         */
        private String createOrg;
        /**
         * transNum
         */
        private String transNum;
        /**
         * length
         */
        private String length;
        /**
         * packingSpec
         */
        private String packingSpec;
        /**
         * fboxNum
         */
        private String fboxNum;
        /**
         * transLineId
         */
        private String transLineId;
        /**
         * volume
         */
        private String volume;
        /**
         * grossWeight
         */
        private String grossWeight;
        /**
         * zboxNum
         */
        private String zboxNum;
        /**
         * netWeight
         */
        private String netWeight;
        /**
         * boxNo
         */
        private String boxNo;
        /**
         * boxNum
         */
        private String boxNum;
        /**
         * 箱号状态编码
         */
        private String transfFlag;
        /**
         * 箱号状态名称
         */
        private String transfFlagName;
        /**
         * width
         */
        private String width;
        /**
         * lineNum
         */
        private int lineNum;
        /**
         * 是否可拆箱类型：ZBOX-0000002000000001：可拆箱
         */
        private String joinType;

        public Boolean getIsChecked() {
            return isChecked == null ? false : isChecked;
        }

        public String getsLength() {
            return length + " M";
        }

        public String getsWidth() {
            return width + " M";
        }

        public String getsHeight() {
            return height + " M";
        }

        public String getsVolume() {
            return volume + " m³";
        }

        public String getsNetWeight() {
            return netWeight + " KG";
        }

        public String getsGrossWeight() {
            return grossWeight + " KG";
        }

        public boolean getIsJoinType() {
            if ("ZBOX-0000002000000001".equals(joinType)) {
                return true;
            }
            return false;
        }

        public boolean getIsTransFFlag() {
            if ("ZBOX-0000005000000003".equals(transfFlag)) {
                return true;
            }
            return false;
        }
    }

    /**
     * 箱子信息
     */
    @NoArgsConstructor
    @Data
    public class Detail implements Serializable {

        /**
         * 需求小队名称
         */
        private String teamName;
        /**
         * updateDate
         */
        private String updateDate;
        /**
         * bsflag
         */
        private String bsflag;
        /**
         * 供应商ID
         */
        private String supplierId;
        /**
         * 供应商编码
         */
        private String supplierCode;
        /**
         * 供应商描述
         */
        private String supplierDesc;
        /**
         * 英文名
         */
        private String materialEdesc;
        /**
         * zboxId
         */
        private String zboxId;
        /**
         * zboxBarcode
         */
        private String zboxBarcode;
        /**
         * 物料名称
         */
        private String materialDesc;
        /**
         * zboxLineId
         */
        private String zboxLineId;
        /**
         * orgId
         */
        private String orgId;
        /**
         * orderQuantity
         */
        private String orderQuantity;
        /**
         * planNum
         */
        private String planNum;
        /**
         * productionDate
         */
        private String productionDate;
        /**
         * refLineId
         */
        private String refLineId;
        /**
         * 物料编码
         */
        private String materialNum;
        /**
         * 单价
         */
        private BigDecimal price;
        /**
         * 规格型号
         */
        private String specModel;
        /**
         * 装箱数量
         */
        private BigDecimal inQuantity;
        /**
         * 订单号
         */
        private String poNum;
        /**
         * 详情id
         */
        private String id;
        /**
         * createDate
         */
        private String createDate;
        /**
         * 金额
         */
        private String amount;
        /**
         * transQuantity
         */
        private String transQuantity;
        /**
         * poLineNum
         */
        private String poLineNum;
        /**
         * accountingAttr
         */
        private String accountingAttr;
        /**
         * updateUser
         */
        private String updateUser;
        /**
         * materialId
         */
        private String materialId;
        /**
         * arrivalDate
         */
        private String arrivalDate;
        /**
         * singleNetWeight
         */
        private String singleNetWeight;
        /**
         * refLineNum
         */
        private String refLineNum;
        /**
         * zboxNum
         */
        private String zboxNum;
        /**
         * 单位
         */
        private String unit;
        /**
         * 分箱单号
         */
        private String refNum;
        /**
         * 箱号
         */
        private String boxNo;
        /**
         * 物料组
         */
        private String materialGroup;
        /**
         * 采办人id
         */
        private String poCreator;
        /**
         * 采办人名称
         */
        private String poCreatorName;
        /**
         * 需求小队
         */
        private String teamId;
        /**
         * 行号
         */
        private String lineNum;
        /**
         * createUser
         */
        private String createUser;
        /**
         * 合同号
         */
        private String contractNum;
        /**
         * refId
         */
        private String refId;
        /**
         * 生产厂家
         */
        private String manufacturer;
    }

    /**
     * 入库提交信息
     */
    @NoArgsConstructor
    @Data
    public static class Commit implements Serializable {
        private String commitType;
        private String bizType;
        private String zboxId;
        private String whId;
        private String location;
        /**
         * 仓位调整-目标仓位
         */
        private String targetLocation;
        private List<CommitLine> refLines;


    }

    /**
     * 入库提交，箱子ID
     */
    @NoArgsConstructor
    @Data
    public static class CommitLine implements Serializable {
        private String zboxLineId;
        private String fboxLineId;
    }

    /**
     * 出库详情
     */
    @NoArgsConstructor
    @Data
    public static class FBox implements Serializable {
        /**
         * 分箱单id
         */
        private String id;
        /**
         * 分箱单号
         */
        private String fboxNum;
        /**
         * 包装箱列表
         */
        private List<Line> lines;
    }

    /**
     * 拆箱装箱提交信息
     */
    @NoArgsConstructor
    @Data
    public static class CommitUnPack implements Serializable {
        /**
         * 固定值-SUBMIT
         */
        private String commitType;
        /**
         * 固定值-MOVE_MATERIAL
         */
        private String bizType;
        /**
         * 源箱子id
         */
        private String zboxLineId;
        /**
         * 是否生成新箱子(0:否  1:是)
         */
        private String newBoxFlag;
        /**
         * 如果选择旧箱子，该字段不能为空，赋值目标箱子id
         */
        private String targetZboxLineId;
        /**
         * 仓位调整-目标仓位
         */
        private String targetLocation;
        private Line newBox;
        private List<CommitUnPackLine> refLines;


    }

    /**
     * 拆箱装箱，箱子ID
     */
    @NoArgsConstructor
    @Data
    public static class CommitUnPackLine implements Serializable {
        private String MaterialNum;
        private String zboxDetailId;
        private BigDecimal moveQuantity;
    }
}
